home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / home / admin / www / migrate.php < prev    next >
Encoding:
PHP Script  |  2005-07-09  |  2.3 KB  |  98 lines

  1. <?
  2. /*
  3. ####################################################
  4. # Name: The Uniform Server Admin Panel 2.0
  5. # Developed By: The Uniform Server Development Team
  6. # Modified Last By: Olajide Olaolorun (empirex)
  7. # Web: http://www.uniformserver.com
  8. ####################################################
  9. */
  10.  
  11. // Includes
  12. include "includes/config.inc.php";
  13. include "$apanel_path/includes/lang/".file_get_contents("includes/.lang").".php";
  14. include "includes/header.php";
  15.  
  16. if ($_POST['submit']) {
  17.  
  18.     function copyr($source, $dest) {
  19.             // Simple copy for a file
  20.             if (is_file($source)) {
  21.                 return copy($source, $dest);
  22.             }
  23.  
  24.             // Make destination directory
  25.             if (!is_dir($dest)) {
  26.                 mkdir($dest);
  27.             }
  28.  
  29.             // Loop through the folder
  30.             $dir = dir($source);
  31.             while (false !== $entry = $dir->read()) {
  32.                 // Skip pointers
  33.                 if ($entry == '.' || $entry == '..' || $entry == 'Thumbs.db') {
  34.                     continue;
  35.                 }
  36.  
  37.                 // Deep copy directories
  38.                 if ($dest !== "$source/$entry") {
  39.                     copyr("$source/$entry", "$dest/$entry");
  40.                 }
  41.             }
  42.  
  43.             // Clean up
  44.             $dir->close();
  45.             return true;
  46.     }
  47.  
  48.     $source1 = $_POST['getlocate'];
  49.     $dest1 = $_POST['destination'];
  50.  
  51.     //copyr($source1, $dest1);
  52. ?>
  53.  
  54. <div id="main">
  55. <h2>» <?=$US['smig-head']?></h2>
  56. <h3><?=$US['smig-sub']?></h3>
  57. <p><?=$US['smig-success']?><br /><?=$_POST['getlocate'];?></p>
  58. </div>
  59.  
  60. <?
  61. }
  62.  
  63. else {
  64. ?>
  65.  
  66.     <div id="main">
  67.     <h2>» <?=$US['smig-head']?></h2>
  68.     <h3><?=$US['smig-sub']?></h3>
  69.     <p><?=$US['smig-text-0']?></p>
  70.  
  71.     <p><?=$US['smig-text-1']?></p>
  72.     <form action="<?=$PHP_SELF?>" method="post">
  73.     <input type="hidden" value="/www/" name="destination" />
  74.     <p>
  75.     <?=$US['smig-www']?>
  76.     <br />
  77.     <input type="text" name="getlocate" />
  78.     </p>
  79.     <input type="submit" name="submit" value="Migrate" />
  80.     </form>
  81.  
  82.     <p><?=$US['smig-text-2']?></p>
  83.     <form action="<?=$PHP_SELF?>" method="post">
  84.     <input type="hidden" value="/usr/local/mysql/data/" name="destination" />
  85.     <p>
  86.     <?=$US['smig-mysql']?>
  87.     <br />
  88.     <input type="text" name="getlocate" />
  89.     </p>
  90.     <input type="submit" name="submit" value="Migrate" />
  91.     </form>
  92.     </div>
  93. <?
  94. }
  95.  
  96. // Footer
  97. include "includes/footer.php";
  98. ?>